package com.jzd1997.lesson2;

import org.apache.commons.lang.math.NumberUtils;
import org.junit.Assert;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @Author: jiangzd
 * @Date: 22:51 2019/7/20
 */
public class CashAcceptTest {

    @Test
    public void testCashReturn(){
        CashSuper cs = new CashReturn("300","100");
        Assert.assertEquals(200,(int)cs.acceptCash(300d));
    }

    @Test
    public void testCashRebate(){
        CashSuper cs = new CashRebate("0.85");
        Assert.assertEquals(170,(int)cs.acceptCash(200d));
    }
    @Test
    public void testCashNormal(){
        CashSuper cs = new CashNormal();
        Assert.assertEquals(100.5d,cs.acceptCash(100.5d),0.1);
        System.out.println(NumberUtils.compare(100.5d,100.5d));
    }
}